package com.kunbo.cn.app.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kunbo.cn.app.service.OrderManagementService;
import com.kunbo.cn.util.retu.BuildBean;
import com.kunbo.cn.util.retu.ResultBean;
/**
 *  (老板APP)订单管理
 * @author  编写人:刘义
 * @date 时间:2019年3月4日上午10:10:36
 */
@RestController
@RequestMapping("/orderManagement")
public class OrderManagementController {
	
	@Autowired
	private OrderManagementService service;
	
	
	
	/**
	 * 采购订单
	 * @return
	 */
	@PostMapping("/getPurchaseOrder")
	public ResultBean<List<Map<String,Object>>> getPurchaseOrder(
			@RequestParam("pruchaseOrder")String pruchaseOrder,
			@RequestParam("page")Integer page,
			@RequestParam("pageSize")Integer pageSize
			){
		ResultBean<List<Map<String,Object>>> result  = new ResultBean<List<Map<String,Object>>>();
		return BuildBean.buildResult(result, "success", "error", service.getPurchaseOrder(page,pageSize,pruchaseOrder));
	}
	
	
	
	/**
	 * 销售订单
	 * @return
	 */
	@PostMapping("/getSalesOrder")
	public ResultBean<List<Map<String,Object>>> getSalesOrder(
			@RequestParam("salesOrder")String salesOrder,
			@RequestParam("page")Integer page,
			@RequestParam("pageSize")Integer pageSize
			){
		ResultBean<List<Map<String,Object>>> result  = new ResultBean<List<Map<String,Object>>>();
		return BuildBean.buildResult(result, "success", "error", service.getSalesOrder(page,pageSize,salesOrder));
	}
	
	
	
	
	/**
	 * 采购订单详情
	 * @return
	 */
	@PostMapping("/purchaseDetails")
	public ResultBean<List<Map<String,Object>>> purchaseDetails(
			@RequestParam("id")Integer id
			){
		ResultBean<List<Map<String,Object>>> result  = new ResultBean<List<Map<String,Object>>>();
		return BuildBean.buildResult(result, "success", "error", service.purchaseDetails(id));
	}
	
	
	
	/**
	 * 销售订单详情
	 * @return
	 */
	@PostMapping("/salesOrderDetails")
	public ResultBean<List<Map<String,Object>>> salesOrderDetails(
			@RequestParam("id")Integer id
			){
		ResultBean<List<Map<String,Object>>> result  = new ResultBean<List<Map<String,Object>>>();
		return BuildBean.buildResult(result, "success", "error", service.salesOrderDetails(id));
	}
	
	
	/**
	 * 老板APP(首页)
	 * @return
	 */
	@PostMapping("/homePage")
	public ResultBean<List<Map<String,Object>>>  homePage(){
		ResultBean<List<Map<String,Object>>> result  = new ResultBean<List<Map<String,Object>>>();
		return BuildBean.buildResult(result, "success", "error", service.homePage());
	}
	

}
